//
//  DetailInfoCell.m
//  International_Hospital
//
//  Created by 统杰李 on 16/7/7.
//  Copyright © 2016年 LiYiLin. All rights reserved.
//

#import "DetailInfoCell.h"

@interface DetailInfoCell ()

//就诊地点
@property (nonatomic,strong) UILabel *siteLabel;

//取号时间
@property (nonatomic,strong) UILabel *timeLabel;

//取号地点
@property (nonatomic,strong) UILabel *numberSiteLabel;

//就诊地点
@property (nonatomic,strong) UILabel *siteLabel1;

//取号时间
@property (nonatomic,strong) UILabel *timeLabel1;

//取号地点
@property (nonatomic,strong) UILabel *numberSiteLabel1;

@end

@implementation DetailInfoCell

#pragma mark
#pragma mark - 重写model
- (void)setModel:(DoctorApplyModel *)model{
    
    _model = model;
    
    self.siteLabel.text = [NSString stringWithFormat:@"%@",model.doctor_hospital_name];
    
    self.timeLabel.text = @"9:00-10:00";
    
    self.numberSiteLabel.text = [NSString stringWithFormat:@"%@住院部",model.doctor_hospital_name];
    
    self.siteLabel1.text = @"就诊地点:";
    self.siteLabel1.textColor = [UIColor blackColor];
    self.timeLabel1.text = @"取号时间:";
    self.timeLabel1.textColor = [UIColor blackColor];
    self.numberSiteLabel1.text = @"取号地点:";
    self.numberSiteLabel1.textColor = [UIColor blackColor];

}

#pragma mark
#pragma mark -  重写initWithStyle方法
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupUI];
    }
    return self;
}

#pragma mark
#pragma mark -  设置UI界面
-(void)setupUI{
    //给label赋值
    self.siteLabel = [self addChildLabel];
    self.timeLabel = [self addChildLabel];
    self.numberSiteLabel = [self addChildLabel];
    self.siteLabel1 = [self addChildLabel];
    self.timeLabel1 = [self addChildLabel];
    self.numberSiteLabel1 = [self addChildLabel];
    
    //添加控件
    [self.contentView addSubview:self.siteLabel];
    [self.contentView addSubview:self.timeLabel];
    [self.contentView addSubview:self.numberSiteLabel];
    [self.contentView addSubview:self.siteLabel1];
    [self.contentView addSubview:self.timeLabel1];
    [self.contentView addSubview:self.numberSiteLabel1];

    //添加约束
    [self.siteLabel1 makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.left).offset(10);
        make.top.equalTo(self.contentView.top).offset(10);
        make.width.equalTo(80);
    }];
    
    [self.siteLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.siteLabel1.right).offset(10);
        make.top.equalTo(self.siteLabel1.top);
    }];
    
    [self.timeLabel1 makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.siteLabel1.left);
        make.right.equalTo(self.siteLabel1.right);
        make.top.equalTo(self.siteLabel1.bottom).offset(10);
    }];
    
    [self.timeLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.timeLabel1.right).offset(10);
        make.top.equalTo(self.siteLabel.bottom).offset(10);
    }];
    
    [self.numberSiteLabel1 makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.timeLabel1.left);
        make.bottom.equalTo(self.contentView.bottom).offset(-10);
        
        make.right.equalTo(self.timeLabel1.right);
    }];
    
    [self.numberSiteLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.numberSiteLabel1.right).offset(10);
        make.bottom.equalTo(self.contentView.bottom).offset(-10);
    }];
}

#pragma mark -
#pragma mark 创建label的方法
-(UILabel *)addChildLabel{
    UILabel *labelNameString = [[UILabel alloc] init];
    
    labelNameString.textColor = [UIColor lightGrayColor];
    
    labelNameString.font = [UIFont systemFontOfSize:17];
    
    [labelNameString sizeToFit];
    
    return labelNameString;
    
}

@end
